package org.bozo.im.service.protocols.xmpp.stanza.processor.roster;

import java.io.IOException;

import org.bozo.im.service.IMService;
import org.bozo.im.service.protocols.xmpp.XMPPSession;
import org.bozo.im.service.protocols.xmpp.stanza.Stanza;
import org.bozo.im.service.protocols.xmpp.stanza.processor.StanzaProcessor;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class QueryStanzaProcessor extends StanzaProcessor {

	private static QueryStanzaProcessor mInstance;
	
	private QueryStanzaProcessor() {}
	
	public static QueryStanzaProcessor getInstance() {
		if (mInstance == null)
			mInstance = new QueryStanzaProcessor();
		return mInstance;
	}
	
	@Override
	public Stanza getStanza() {
		return Stanza.ROSTER_QUERY;
	}

	@Override
	public void processStanza(XmlPullParser pParser, XMPPSession pSession, StanzaProcessor pParentProcessor) throws XmlPullParserException, IOException {
		super.processStanza(pParser, pSession, pParentProcessor);
		
		IMService.getInstance().getRoster().pushContacts();
	}
}
